package ontowebapp.trimstring.control.lib;

import ontocompo.control.api.ControllerItf;
import ontocompo.control.lib.Controller;

import org.objectweb.fractal.fraclet.annotations.Component;
import org.objectweb.fractal.fraclet.annotations.Interface;
import org.objectweb.fractal.fraclet.annotations.Requires;

@Component(provides = {@Interface(name = "controllerItf", signature = ontocompo.control.api.ControllerItf.class), @Interface(name = "ontocompoIntrospectionItf", signature = ontocompo.api.IntrospectionItf.class)})
public class TrimController extends Controller implements ControllerItf {

	@Requires(name = "textToTrimInput")
	private ontocompo.ui.api.TextInputItf textToTrimInput;
	
	@Requires(name = "patternToRemoveInput")
	private ontocompo.ui.api.TextInputItf patternToRemoveInput;
	
	@Requires(name = "trimedStringResult")
	private ontocompo.ui.api.LabelItf trimedStringResult;
	
	@Requires(name = "trimService")
	private ontowebapp.trimstring.fc.api.TrimItf trimService;
	
	public TrimController() {
		this.uid = "ontowebapp.trimstring.control.lib.TrimController";
	}
	
	
	@Override
	public void execute() {
		/*System.out.println();
		System.out.println(this.textToTrimInput.getContent());
		System.out.println();
		System.out.println(this.patternToRemoveInput.getContent());
		System.out.println();
		System.out.println(this.trimService.trim(this.textToTrimInput.getContent(), this.patternToRemoveInput.getContent()));
		System.out.println();*/
		
		this.trimedStringResult.setContent(this.trimService.trim(this.textToTrimInput.getContent(), this.patternToRemoveInput.getContent()));
	}

}